package com.drama.api.task;

import cn.hutool.json.JSONObject;
import com.drama.util.RestTemplateUtils;
import org.springframework.http.ResponseEntity;


public class DeleteFileThread extends Thread {

    private RestTemplateUtils restTemplateUtils;
    private String serviceUrl;
    private String fileUrl;

    public DeleteFileThread(RestTemplateUtils restTemplateUtils,String serviceUrl,String fileUrl)
    {
        this.restTemplateUtils=restTemplateUtils;
        this.fileUrl=fileUrl;
        this.serviceUrl=serviceUrl;
    }

    @Override
    public void run() {
        System.out.println("请求资源服务器删除文件：："+fileUrl);
        JSONObject jsonObject=new JSONObject();
//        jsonObject.putOnce("appId","sakdhiqowhiohi131231313");
//        jsonObject.putOnce("url",fileUrl);
        serviceUrl+="?appId=sakdhiqowhiohi131231313&url="+fileUrl;
        ResponseEntity responseEntity=restTemplateUtils.post(serviceUrl,jsonObject, JSONObject.class);
        System.out.println(responseEntity.getBody());
    }


}
